<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>File Source for TpDb.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
						<h1>Source for file TpDb.php</h1>
<p>Documentation is available at <a href="../TurboPhpLib/_TpDb_php.html">TpDb.php</a></p>
<div class="src-code">
<pre><ol><li><a name="a1"></a><span class="src-php">&lt;?php</span></li>
<li><a name="a2"></a>&nbsp;</li>
<li><a name="a3"></a><span class="src-doc">/**</span></li>
<li><a name="a4"></a><span class="src-doc"> *  TurboPhp 4 - TpDb</span></li>
<li><a name="a5"></a><span class="src-doc"> *  Version 4.0.1 Beta</span></li>
<li><a name="a6"></a><span class="src-doc"> *</span></li>
<li><a name="a7"></a><span class="src-doc"> *  Copyright (c) 2004 Least-Resistance Software</span></li>
<li><a name="a8"></a><span class="src-doc"> *</span></li>
<li><a name="a9"></a><span class="src-doc"> *  This source file is subject to the terms of the TurboPhp license,</span></li>
<li><a name="a10"></a><span class="src-doc"> *  that is bundled with this package in the file LICENSE.TXT, and is</span></li>
<li><a name="a11"></a><span class="src-doc"> *  available at through the world-wide-web at</span></li>
<li><a name="a12"></a><span class="src-doc"> *  http://www.turbophp.com/turbophp/license.txt</span></li>
<li><a name="a13"></a><span class="src-doc"> *</span></li>
<li><a name="a14"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> TurboPhpLib</span></li>
<li><a name="a15"></a><span class="src-doc"> */</span></li>
<li><a name="a16"></a>&nbsp;</li>
<li><a name="a17"></a><span class="src-doc-template">/**#@+</span></li>
<li><a name="a18"></a><span class="src-doc-template"> * </span><span class="src-doc-coretag">@access</span><span class="src-doc-template"> private</span></li>
<li><a name="a19"></a><span class="src-doc-template"> */</span></li>
<li><a name="a20"></a><a href="../TurboPhpLib/_TpLib_php.html#functionTpRegisterClass">TpRegisterClass</a><span class="src-sym">(</span><span class="src-str">'dbtext'</span><span class="src-sym">, </span><span class="src-str">'TTpDbText'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a21"></a><a href="../TurboPhpLib/_TpLib_php.html#functionTpRegisterClass">TpRegisterClass</a><span class="src-sym">(</span><span class="src-str">'dbedit'</span><span class="src-sym">, </span><span class="src-str">'TTpDbEdit'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a22"></a><a href="../TurboPhpLib/_TpLib_php.html#functionTpRegisterClass">TpRegisterClass</a><span class="src-sym">(</span><span class="src-str">'dbtextarea'</span><span class="src-sym">, </span><span class="src-str">'TTpDbTextArea'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a23"></a><a href="../TurboPhpLib/_TpLib_php.html#functionTpRegisterClass">TpRegisterClass</a><span class="src-sym">(</span><span class="src-str">'dblistsource'</span><span class="src-sym">, </span><span class="src-str">'TTpDbListSource'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a24"></a>&nbsp;</li>
<li><a name="a25"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'P_QUERY_PARAM'</span><span class="src-sym">, </span><span class="src-str">'#{%([^}]*)}#Usm'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a29"></a><span class="src-doc-close-template">/**#@-*/</span><span class="src-comm"> * Generic database connection object.</span></li>
<li><a name="a30"></a><span class="src-comm"> */</span></li>
<li><a name="a31"></a><span class="src-key">class </span><a href="../TurboPhpLib/TTpDbConnect.html">TTpDbConnect</a> <span class="src-key">extends </span><a href="../TurboPhpLib/TTpSilentObj.html">TTpSilentObj</a></li>
<li><a name="a32"></a><span class="src-sym">{</span></li>
<li><a name="a33"></a>  <span class="src-doc">/**</span></li>
<li><a name="a34"></a><span class="src-doc">   * Path to configuration file.</span></li>
<li><a name="a35"></a><span class="src-doc">   * Database access data (server address, login, password) is stored</span></li>
<li><a name="a36"></a><span class="src-doc">   * separately so:</span></li>
<li><a name="a37"></a><span class="src-doc">   * 1. Configuration files can be stored off the browsable folder tree.</span></li>
<li><a name="a38"></a><span class="src-doc">   * 2. Database connections can be altered by replacing or editing the configuration file.</span></li>
<li><a name="a39"></a><span class="src-doc">   * 3. Source code can be shared without regard to database security details.</span></li>
<li><a name="a40"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a41"></a><span class="src-doc">   */</span></li>
<li><a name="a42"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$ConfigFile">$ConfigFile</a><span class="src-sym">;</span></li>
<li><a name="a43"></a>  <span class="src-doc">/**</span></li>
<li><a name="a44"></a><span class="src-doc">   * Abstract connection object.</span></li>
<li><a name="a45"></a><span class="src-doc">   * Represents a database connection identifier or handle.</span></li>
<li><a name="a46"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">mixed </span></li>
<li><a name="a47"></a><span class="src-doc">   */</span></li>
<li><a name="a48"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$Connection">$Connection</a><span class="src-sym">;</span></li>
<li><a name="a49"></a>  <span class="src-doc">/**</span></li>
<li><a name="a50"></a><span class="src-doc">   * True if connections will be initiated manually.</span></li>
<li><a name="a51"></a><span class="src-doc">   * By default database connections are automatically opened</span></li>
<li><a name="a52"></a><span class="src-doc">   * after application object parsing. If $ConnectManually is</span></li>
<li><a name="a53"></a><span class="src-doc">   * true, the connection will instead need to be opened by</span></li>
<li><a name="a54"></a><span class="src-doc">   * an explicit call to the </span><span class="src-doc-inlinetag">{@link Connect}</span><span class="src-doc"> function.</span></li>
<li><a name="a55"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></li>
<li><a name="a56"></a><span class="src-doc">   */</span></li>
<li><a name="a57"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$ConnectManually">$ConnectManually</a><span class="src-sym">;</span></li>
<li><a name="a58"></a>  <span class="src-doc">/**</span></li>
<li><a name="a59"></a><span class="src-doc">   * Name of the connected database.</span></li>
<li><a name="a60"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a61"></a><span class="src-doc">   */</span></li>
<li><a name="a62"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$Database">$Database</a><span class="src-sym">;</span></li>
<li><a name="a63"></a>  <span class="src-doc">/**</span></li>
<li><a name="a64"></a><span class="src-doc">   * Address of the database server.</span></li>
<li><a name="a65"></a><span class="src-doc">   * Normally loaded from configuration file.</span></li>
<li><a name="a66"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a67"></a><span class="src-doc">   */</span></li>
<li><a name="a68"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$Host">$Host</a><span class="src-sym">;</span></li>
<li><a name="a69"></a>  <span class="src-doc">/**</span></li>
<li><a name="a70"></a><span class="src-doc">   * Event fired just before openeing the connection.</span></li>
<li><a name="a71"></a><span class="src-doc">   * Normally loaded from configuration file.</span></li>
<li><a name="a72"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a73"></a><span class="src-doc">   */</span></li>
<li><a name="a74"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$OnConnect">$OnConnect</a><span class="src-sym">;</span></li>
<li><a name="a75"></a>  <span class="src-doc">/**</span></li>
<li><a name="a76"></a><span class="src-doc">   * Password for database access.</span></li>
<li><a name="a77"></a><span class="src-doc">   * Normally loaded from configuration file.</span></li>
<li><a name="a78"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a79"></a><span class="src-doc">   */</span></li>
<li><a name="a80"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$Password">$Password</a><span class="src-sym">;</span></li>
<li><a name="a81"></a>  <span class="src-doc">/**</span></li>
<li><a name="a82"></a><span class="src-doc">   * Specifies whether the connection to the database should be persistent.</span></li>
<li><a name="a83"></a><span class="src-doc">   * When the connection is opened, this property is checked to determine if</span></li>
<li><a name="a84"></a><span class="src-doc">   * the connection should be opened in persistent mode.</span></li>
<li><a name="a85"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></li>
<li><a name="a86"></a><span class="src-doc">   */</span></li>
<li><a name="a87"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$Persistent">$Persistent</a><span class="src-sym">;</span></li>
<li><a name="a88"></a>  <span class="src-doc">/**</span></li>
<li><a name="a89"></a><span class="src-doc">   * User name or login for database access.</span></li>
<li><a name="a90"></a><span class="src-doc">   * Normally loaded from configuration file.</span></li>
<li><a name="a91"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a92"></a><span class="src-doc">   */</span></li>
<li><a name="a93"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbConnect.html#var$UserName">$UserName</a><span class="src-sym">;</span></li>
<li><a name="a94"></a>  <span class="src-doc">/**</span></li>
<li><a name="a95"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a96"></a><span class="src-doc">   */</span></li>
<li><a name="a97"></a>  <span class="src-key">function </span><span class="src-id">Init</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a98"></a>  <span class="src-sym">{</span></li>
<li><a name="a99"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">Init</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a100"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Host">Host</a> = <span class="src-str">''</span><span class="src-sym">;</span></li>
<li><a name="a101"></a>  <span class="src-sym">}</span></li>
<li><a name="a102"></a>  <span class="src-doc">/**</span></li>
<li><a name="a103"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a104"></a><span class="src-doc">   */</span></li>
<li><a name="a105"></a>  <span class="src-key">function </span><span class="src-id">StoreAttr</span><span class="src-sym">(</span><span class="src-var">$inName</span><span class="src-sym">, </span><span class="src-var">$inValue</span><span class="src-sym">)</span></li>
<li><a name="a106"></a>  <span class="src-sym">{</span></li>
<li><a name="a107"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$inName </span>== <span class="src-str">'tphost'</span><span class="src-sym">)</span></li>
<li><a name="a108"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Host">Host</a> = <span class="src-var">$inValue</span><span class="src-sym">;</span></li>
<li><a name="a109"></a>    <span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$inName </span>== <span class="src-str">'tpuser'</span><span class="src-sym">)</span></li>
<li><a name="a110"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$UserName">UserName</a> = <span class="src-var">$inValue</span><span class="src-sym">;</span></li>
<li><a name="a111"></a>    <span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$inName </span>== <span class="src-str">'tppassword'</span><span class="src-sym">)</span></li>
<li><a name="a112"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Password">Password</a> = <span class="src-var">$inValue</span><span class="src-sym">;</span></li>
<li><a name="a113"></a>    <span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$inName </span>== <span class="src-str">'tpdatabase'</span><span class="src-sym">)</span></li>
<li><a name="a114"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Database">Database</a> = <span class="src-var">$inValue</span><span class="src-sym">;</span></li>
<li><a name="a115"></a>    <span class="src-key">else</span></li>
<li><a name="a116"></a>      <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">StoreAttr</span><span class="src-sym">(</span><span class="src-var">$inName</span><span class="src-sym">, </span><span class="src-var">$inValue</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a117"></a>  <span class="src-sym">}</span></li>
<li><a name="a118"></a>  <span class="src-doc">/**</span></li>
<li><a name="a119"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a120"></a><span class="src-doc">   */</span></li>
<li><a name="a121"></a>  <span class="src-key">function </span><span class="src-id">AfterParse</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a122"></a>  <span class="src-sym">{</span></li>
<li><a name="a123"></a>    <span class="src-key">global </span><span class="src-var">$tpSupportPath</span><span class="src-sym">;</span></li>
<li><a name="a124"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$ConfigFile">ConfigFile</a> == <span class="src-str">''</span><span class="src-sym">)</span></li>
<li><a name="a125"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$ConfigFile">ConfigFile</a> = <span class="src-var">$tpSupportPath </span>. <span class="src-str">&quot;</span><span class="src-str"><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$Name">Name</a>.<span class="src-id">conf</span>.<span class="src-id">php</span></span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a126"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$ConnectManually">ConnectManually</a><span class="src-sym">)</span></li>
<li><a name="a127"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#methodAutoConnect">AutoConnect</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a128"></a>  <span class="src-sym">}</span></li>
<li><a name="a129"></a>  <span class="src-doc">/**</span></li>
<li><a name="a130"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a131"></a><span class="src-doc">   */</span></li>
<li><a name="a132"></a>  <span class="src-key">function </span><span class="src-id">LoadConfig</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a133"></a>  <span class="src-sym">{</span></li>
<li><a name="a134"></a>    <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$ConfigFile">ConfigFile</a><span class="src-sym">))</span></li>
<li><a name="a135"></a>    <span class="src-sym">{</span></li>
<li><a name="a136"></a>      <span class="src-var">$conf </span>= <a href="http://www.php.net/parse_ini_file">parse_ini_file</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$ConfigFile">ConfigFile</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a137"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Host">Host</a> = <a href="../TurboPhpLib/_TpLib_php.html#functionTpSafeArrayGet">TpSafeArrayGet</a><span class="src-sym">(</span><span class="src-str">'Host'</span><span class="src-sym">, </span><span class="src-var">$conf</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a138"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$UserName">UserName</a> = <a href="../TurboPhpLib/_TpLib_php.html#functionTpSafeArrayGet">TpSafeArrayGet</a><span class="src-sym">(</span><span class="src-str">'User'</span><span class="src-sym">, </span><span class="src-var">$conf</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a139"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Password">Password</a> = <a href="../TurboPhpLib/_TpLib_php.html#functionTpSafeArrayGet">TpSafeArrayGet</a><span class="src-sym">(</span><span class="src-str">'Password'</span><span class="src-sym">, </span><span class="src-var">$conf</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a140"></a>    <span class="src-sym">}</span></li>
<li><a name="a141"></a>  <span class="src-sym">}</span></li>
<li><a name="a142"></a>  <span class="src-doc">/**</span></li>
<li><a name="a143"></a><span class="src-doc">   * Select the database </span><span class="src-doc-inlinetag">{@link $Database}</span><span class="src-doc">.</span></li>
<li><a name="a144"></a><span class="src-doc">   * Connection must be open to select a databse.</span></li>
<li><a name="a145"></a><span class="src-doc">   */</span></li>
<li><a name="a146"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbConnect.html#methodSelectDatabase">SelectDatabase</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a147"></a>  <span class="src-sym">{</span></li>
<li><a name="a148"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Connection">Connection</a> &amp;&amp; <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Database">Database</a> &lt;&gt; <span class="src-str">''</span><span class="src-sym">)</span></li>
<li><a name="a149"></a>      <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">DoSelectDb</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-comm">// abstract: must be provided in subclass</span></li>
<li><a name="a150"></a>    <span class="src-key">else </span><span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$App">App</a><span class="src-sym">-&gt;</span><span class="src-id">Debug</span><span class="src-sym">)</span></li>
<li><a name="a151"></a>      <span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a152"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Connection">Connection</a><span class="src-sym">)</span></li>
<li><a name="a153"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot; no connection available.&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a154"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Database">Database</a> == <span class="src-str">''</span><span class="src-sym">)</span></li>
<li><a name="a155"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot; no database selected (property is empty)&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a156"></a>  <span class="src-sym">}</span></li>
<li><a name="a157"></a>  <span class="src-doc">/**</span></li>
<li><a name="a158"></a><span class="src-doc">   * Open the database server connection, if it's not already open.</span></li>
<li><a name="a159"></a><span class="src-doc">   * Before opening a database connection, the </span><span class="src-doc-inlinetag">{@link OnConnect}</span><span class="src-doc"> event</span></li>
<li><a name="a160"></a><span class="src-doc">   * is fired, and then an attempt is made to load the configuration file.</span></li>
<li><a name="a161"></a><span class="src-doc">   * See also </span><span class="src-doc-inlinetag">{@link $ConfigFile}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link $Persistent}</span><span class="src-doc">.</span></li>
<li><a name="a162"></a><span class="src-doc">   *</span></li>
<li><a name="a163"></a><span class="src-doc">   * Note: before access, a database should be selected on the</span></li>
<li><a name="a164"></a><span class="src-doc">   * connection. See </span><span class="src-doc-inlinetag">{@link $Database}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link SelectDatabase}</span><span class="src-doc">.</span></li>
<li><a name="a165"></a><span class="src-doc">   */</span></li>
<li><a name="a166"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbConnect.html#methodConnect">Connect</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a167"></a>  <span class="src-sym">{</span></li>
<li><a name="a168"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Connection">Connection</a><span class="src-sym">)</span></li>
<li><a name="a169"></a>    <span class="src-sym">{</span></li>
<li><a name="a170"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">DoEvent</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$OnConnect">OnConnect</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a171"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">LoadConfig</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a172"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">DoConnect</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-comm">// abstract: must be provided in subclass</span></li>
<li><a name="a173"></a>    <span class="src-sym">}</span></li>
<li><a name="a174"></a>    <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Connection">Connection</a><span class="src-sym">;</span></li>
<li><a name="a175"></a>  <span class="src-sym">}</span></li>
<li><a name="a176"></a>  <span class="src-doc">/**</span></li>
<li><a name="a177"></a><span class="src-doc">   * Open the database connection and select the databse.</span></li>
<li><a name="a178"></a><span class="src-doc">   * Called after application object parsing unless </span><span class="src-doc-inlinetag">{@link $ConnectManually}</span></li>
<li><a name="a179"></a><span class="src-doc">   * is true.</span></li>
<li><a name="a180"></a><span class="src-doc">   */</span></li>
<li><a name="a181"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbConnect.html#methodAutoConnect">AutoConnect</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a182"></a>  <span class="src-sym">{</span></li>
<li><a name="a183"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#methodConnect">Connect</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a184"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#methodSelectDatabase">SelectDatabase</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a185"></a>  <span class="src-sym">}</span></li>
<li><a name="a186"></a>  <span class="src-doc">/**</span></li>
<li><a name="a187"></a><span class="src-doc">   * Connect to the database server, halting the application on error.</span></li>
<li><a name="a188"></a><span class="src-doc">   */</span></li>
<li><a name="a189"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbConnect.html#methodConnectOrDie">ConnectOrDie</a><span class="src-sym">(</span><span class="src-var">$inMessage </span>= <span class="src-str">''</span><span class="src-sym">)</span></li>
<li><a name="a190"></a>  <span class="src-sym">{</span></li>
<li><a name="a191"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$inMessage </span>== <span class="src-str">''</span><span class="src-sym">)</span></li>
<li><a name="a192"></a>      <span class="src-var">$inMessage </span>= <span class="src-str">'Could not connect: '</span><span class="src-sym">;</span></li>
<li><a name="a193"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#methodConnect">Connect</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-key">or </span><span class="src-key">die</span><span class="src-sym">(</span><span class="src-var">$inMessage </span>. <a href="http://www.php.net/mysql_error">mysql_error</a><span class="src-sym">(</span><span class="src-sym">) </span>. <span class="src-str">'&lt;br&gt;'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a194"></a>  <span class="src-sym">}</span></li>
<li><a name="a195"></a>  <span class="src-doc">/**</span></li>
<li><a name="a196"></a><span class="src-doc">   * Close the database server connection.</span></li>
<li><a name="a197"></a><span class="src-doc">   */</span></li>
<li><a name="a198"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbConnect.html#methodClose">Close</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a199"></a>  <span class="src-sym">{</span></li>
<li><a name="a200"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Connection">Connection</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a201"></a>  <span class="src-sym">}</span></li>
<li><a name="a202"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbConnect.html#methodDump">Dump</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a203"></a>  <span class="src-sym">{</span></li>
<li><a name="a204"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">Dump</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a205"></a>    echo <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">Host</span>: <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Host">Host</a><span class="src-sym">]</span>&lt;<span class="src-id">br</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a206"></a>    echo <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">User</span>: <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$UserName">UserName</a><span class="src-sym">]</span>&lt;<span class="src-id">br</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a207"></a>    echo <span class="src-str">&quot;Password: &lt;hidden&gt;&lt;br&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a208"></a>    echo <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">Persistent</span>: <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Persistent">Persistent</a><span class="src-sym">]</span>&lt;<span class="src-id">br</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a209"></a>    echo <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">Database</span>: <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbConnect.html#var$Database">Database</a><span class="src-sym">]</span>&lt;<span class="src-id">br</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a210"></a>  <span class="src-sym">}</span></li>
<li><a name="a211"></a><span class="src-sym">}</span></li>
<li><a name="a212"></a>&nbsp;</li>
<li><a name="a213"></a><span class="src-doc">/**</span></li>
<li><a name="a214"></a><span class="src-doc"> * Generic source for data sets.</span></li>
<li><a name="a215"></a><span class="src-doc"> */</span></li>
<li><a name="a216"></a><span class="src-key">class </span><a href="../TurboPhpLib/TTpDataSource.html">TTpDataSource</a> <span class="src-key">extends </span><a href="../TurboPhpLib/TTpSilentObj.html">TTpSilentObj</a></li>
<li><a name="a217"></a><span class="src-sym">{</span></li>
<li><a name="a218"></a>  <span class="src-doc">/**</span></li>
<li><a name="a219"></a><span class="src-doc">   * Reference to the linked DB connection object.</span></li>
<li><a name="a220"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">object; </span></li>
<li><a name="a221"></a><span class="src-doc">   */</span></li>
<li><a name="a222"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDataSource.html#var$Connection">$Connection</a><span class="src-sym">;</span></li>
<li><a name="a223"></a>  <span class="src-doc">/**</span></li>
<li><a name="a224"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a225"></a><span class="src-doc">   */</span></li>
<li><a name="a226"></a>  <span class="src-doc">/**</span></li>
<li><a name="a227"></a><span class="src-doc">   * Query result. Actual type and value depends on the type of data source.</span></li>
<li><a name="a228"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">mixed </span></li>
<li><a name="a229"></a><span class="src-doc">   */</span></li>
<li><a name="a230"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDataSource.html#var$Result">$Result</a><span class="src-sym">;</span></li>
<li><a name="a231"></a>  <span class="src-doc">/**</span></li>
<li><a name="a232"></a><span class="src-doc">   * A row of data. Usually a hash.</span></li>
<li><a name="a233"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></li>
<li><a name="a234"></a><span class="src-doc">   */</span></li>
<li><a name="a235"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDataSource.html#var$Row">$Row</a><span class="src-sym">;</span></li>
<li><a name="a236"></a>  <span class="src-doc">/**</span></li>
<li><a name="a237"></a><span class="src-doc">   * Default field for accessing list data.</span></li>
<li><a name="a238"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@see</span><span class="src-doc"> GetItems</span></li>
<li><a name="a239"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a240"></a><span class="src-doc">   */</span></li>
<li><a name="a241"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDataSource.html#var$Field">$Field</a><span class="src-sym">;</span></li>
<li><a name="a242"></a>  <span class="src-doc">/**</span></li>
<li><a name="a243"></a><span class="src-doc">   * Event fired before data is accessed.</span></li>
<li><a name="a244"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a245"></a><span class="src-doc">   */</span></li>
<li><a name="a246"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDataSource.html#var$OnBeforeExecute">$OnBeforeExecute</a><span class="src-sym">;</span></li>
<li><a name="a247"></a>  <span class="src-doc">/**</span></li>
<li><a name="a248"></a><span class="src-doc">   * Event fired if there is an error with data access.</span></li>
<li><a name="a249"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a250"></a><span class="src-doc">   */</span></li>
<li><a name="a251"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDataSource.html#var$OnFailure">$OnFailure</a><span class="src-sym">;</span></li>
<li><a name="a252"></a>  <span class="src-doc">/**</span></li>
<li><a name="a253"></a><span class="src-doc">   * Event fired if data was accessed successfully.</span></li>
<li><a name="a254"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a255"></a><span class="src-doc">   */</span></li>
<li><a name="a256"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDataSource.html#var$OnSuccess">$OnSuccess</a><span class="src-sym">;</span></li>
<li><a name="a257"></a>  <span class="src-doc">/**</span></li>
<li><a name="a258"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a259"></a><span class="src-doc">   */</span></li>
<li><a name="a260"></a>  <span class="src-key">function </span><span class="src-id">Init</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a261"></a>  <span class="src-sym">{</span></li>
<li><a name="a262"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">Init</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a263"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Row">Row</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a264"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Field">Field</a> = <span class="src-num">0</span><span class="src-sym">;</span></li>
<li><a name="a265"></a>  <span class="src-sym">}</span></li>
<li><a name="a266"></a>  <span class="src-doc">/**</span></li>
<li><a name="a267"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a268"></a><span class="src-doc">   */</span></li>
<li><a name="a269"></a>  <span class="src-key">function </span><span class="src-id">AfterParse</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a270"></a>  <span class="src-sym">{</span></li>
<li><a name="a271"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">MarshallObject</span><span class="src-sym">(</span><span class="src-str">'Connection'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a272"></a>  <span class="src-sym">}</span></li>
<li><a name="a273"></a>  <span class="src-doc">/**</span></li>
<li><a name="a274"></a><span class="src-doc">   * Hook function for executing a data query.</span></li>
<li><a name="a275"></a><span class="src-doc">   * Subclasses extend this function to provide specific functionality.</span></li>
<li><a name="a276"></a><span class="src-doc">   */</span></li>
<li><a name="a277"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDataSource.html#methodDoExecute">DoExecute</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a278"></a>  <span class="src-sym">{</span></li>
<li><a name="a279"></a>    <span class="src-comm">// Abstract. Must be provided by subclass.</span></li>
<li><a name="a280"></a>  <span class="src-sym">}</span></li>
<li><a name="a281"></a>  <span class="src-doc">/**</span></li>
<li><a name="a282"></a><span class="src-doc">   * Perform data acess.</span></li>
<li><a name="a283"></a><span class="src-doc">   * Fires </span><span class="src-doc-inlinetag">{@link OnBeforeExecute}</span><span class="src-doc"> then calls </span><span class="src-doc-inlinetag">{@link ExecuteQuery}</span><span class="src-doc">.</span></li>
<li><a name="a284"></a><span class="src-doc">   * Subsequently fires </span><span class="src-doc-inlinetag">{@link OnFailure}</span><span class="src-doc"> or </span><span class="src-doc-inlinetag">{@link OnSuccess}</span><span class="src-doc"> depending</span></li>
<li><a name="a285"></a><span class="src-doc">   * on the value of </span><span class="src-doc-inlinetag">{@link Result}</span><span class="src-doc">.</span></li>
<li><a name="a286"></a><span class="src-doc">   * This function is called automatically if data access</span></li>
<li><a name="a287"></a><span class="src-doc">   * functions are invoked and data is not yet available.</span></li>
<li><a name="a288"></a><span class="src-doc">   * Specifically </span><span class="src-doc-inlinetag">{@link Next}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link Rewind}</span><span class="src-doc"> and </span><span class="src-doc-inlinetag">{@link GetField}</span></li>
<li><a name="a289"></a><span class="src-doc">   * will call Execute if needed.</span></li>
<li><a name="a290"></a><span class="src-doc">   */</span></li>
<li><a name="a291"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDataSource.html#methodExecute">Execute</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a292"></a>  <span class="src-sym">{</span></li>
<li><a name="a293"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">DoEvent</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$OnBeforeExecute">OnBeforeExecute</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a294"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#methodDoExecute">DoExecute</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a295"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Result">Result</a><span class="src-sym">)</span></li>
<li><a name="a296"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">DoEvent</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$OnFailure">OnFailure</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a297"></a>    <span class="src-key">else</span></li>
<li><a name="a298"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">DoEvent</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$OnSuccess">OnSuccess</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a299"></a>  <span class="src-sym">}</span></li>
<li><a name="a300"></a>  <span class="src-doc">/**</span></li>
<li><a name="a301"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a302"></a><span class="src-doc">   */</span></li>
<li><a name="a303"></a>  <span class="src-key">function </span><span class="src-id">NeedData</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a304"></a>  <span class="src-sym">{</span></li>
<li><a name="a305"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Result">Result</a><span class="src-sym">)</span></li>
<li><a name="a306"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#methodExecute">Execute</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a307"></a>  <span class="src-sym">}</span></li>
<li><a name="a308"></a>  <span class="src-doc">/**</span></li>
<li><a name="a309"></a><span class="src-doc">   * True if the end of data has been reached.</span></li>
<li><a name="a310"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span></li>
<li><a name="a311"></a><span class="src-doc">   */</span></li>
<li><a name="a312"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDataSource.html#methodEOF">EOF</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a313"></a>  <span class="src-sym">{</span></li>
<li><a name="a314"></a>    <span class="src-key">return </span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Row">Row</a><span class="src-sym">;</span></li>
<li><a name="a315"></a>  <span class="src-sym">}</span></li>
<li><a name="a316"></a>  <span class="src-doc">/**</span></li>
<li><a name="a317"></a><span class="src-doc">   * Rewinds the row pointer to the first row in the result set.</span></li>
<li><a name="a318"></a><span class="src-doc">   * Calls </span><span class="src-doc-inlinetag">{@link Execute}</span><span class="src-doc"> if needed.</span></li>
<li><a name="a319"></a><span class="src-doc">   */</span></li>
<li><a name="a320"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDataSource.html#methodRewind">Rewind</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a321"></a>  <span class="src-sym">{</span></li>
<li><a name="a322"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">NeedData</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a323"></a>  <span class="src-sym">}</span></li>
<li><a name="a324"></a>  <span class="src-doc">/**</span></li>
<li><a name="a325"></a><span class="src-doc">   * </span><span class="src-doc-tag">@abtract</span></li>
<li><a name="a326"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a327"></a><span class="src-doc">   */</span></li>
<li><a name="a328"></a>  <span class="src-key">function </span><span class="src-id">DoNextRow</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a329"></a>  <span class="src-sym">{</span></li>
<li><a name="a330"></a>  <span class="src-sym">}</span></li>
<li><a name="a331"></a>  <span class="src-doc">/**</span></li>
<li><a name="a332"></a><span class="src-doc">   * Fill </span><span class="src-doc-inlinetag">{@link $Row}</span><span class="src-doc"> with the next row of data.</span></li>
<li><a name="a333"></a><span class="src-doc">   * Calls </span><span class="src-doc-inlinetag">{@link Execute}</span><span class="src-doc"> if needed.</span></li>
<li><a name="a334"></a><span class="src-doc">   */</span></li>
<li><a name="a335"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDataSource.html#methodNext">Next</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a336"></a>  <span class="src-sym">{</span></li>
<li><a name="a337"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">NeedData</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a338"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Result">Result</a><span class="src-sym">)</span></li>
<li><a name="a339"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">DoNextRow</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a340"></a>    <span class="src-key">return </span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#methodEOF">EOF</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a341"></a>  <span class="src-sym">}</span></li>
<li><a name="a342"></a>  <span class="src-doc">/**</span></li>
<li><a name="a343"></a><span class="src-doc">   * Get field data from the current row.</span></li>
<li><a name="a344"></a><span class="src-doc">   * Calls </span><span class="src-doc-inlinetag">{@link Execute}</span><span class="src-doc"> if needed.</span></li>
<li><a name="a345"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">Value </span><span class="src-doc">of key $inFieldId in the array </span><span class="src-doc-inlinetag">{@link $Row}</span><span class="src-doc">, or false</span></li>
<li><a name="a346"></a><span class="src-doc">   *  if the key does not exist.</span></li>
<li><a name="a347"></a><span class="src-doc">   */</span></li>
<li><a name="a348"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDataSource.html#methodGetField">GetField</a><span class="src-sym">(</span><span class="src-var">$inFieldId</span><span class="src-sym">)</span></li>
<li><a name="a349"></a>  <span class="src-sym">{</span></li>
<li><a name="a350"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">NeedData</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a351"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Row">Row</a><span class="src-sym">)</span></li>
<li><a name="a352"></a>      <span class="src-key">return </span><span class="src-str">'(bad row)'</span><span class="src-sym">;</span></li>
<li><a name="a353"></a>    <span class="src-key">else</span></li>
<li><a name="a354"></a>      <span class="src-key">return </span><a href="../TurboPhpLib/_TpLib_php.html#functionTpSafeArrayGet">TpSafeArrayGet</a><span class="src-sym">(</span><span class="src-var">$inFieldId</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Row">Row</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a355"></a>  <span class="src-sym">}</span></li>
<li><a name="a356"></a>  <span class="src-doc">/**</span></li>
<li><a name="a357"></a><span class="src-doc">   * Add an entire column of the result data to $outItems.</span></li>
<li><a name="a358"></a><span class="src-doc">   * The column identified by the </span><span class="src-doc-inlinetag">{@link $Field}</span><span class="src-doc"> property is copied.</span></li>
<li><a name="a359"></a><span class="src-doc">   * By default, the first column of the data set is used.</span></li>
<li><a name="a360"></a><span class="src-doc">   *</span></li>
<li><a name="a361"></a><span class="src-doc">   * This function implements the </span><span class="src-doc-inlinetag">{@link TpListSource}</span><span class="src-doc"> functionality</span></li>
<li><a name="a362"></a><span class="src-doc">   * for data sources.</span></li>
<li><a name="a363"></a><span class="src-doc">   */</span></li>
<li><a name="a364"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDataSource.html#methodGetItems">GetItems</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$outItems</span><span class="src-sym">)</span></li>
<li><a name="a365"></a>  <span class="src-sym">{</span></li>
<li><a name="a366"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#methodRewind">Rewind</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a367"></a>    <span class="src-key">while </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#methodNext">Next</a><span class="src-sym">(</span><span class="src-sym">))</span></li>
<li><a name="a368"></a>      <span class="src-var">$outItems</span><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-sym">@</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Row">Row</a><span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDataSource.html#var$Field">Field</a><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a369"></a>  <span class="src-sym">}</span></li>
<li><a name="a370"></a><span class="src-sym">}</span></li>
<li><a name="a371"></a>&nbsp;</li>
<li><a name="a372"></a><span class="src-doc">/**</span></li>
<li><a name="a373"></a><span class="src-doc"> * Generic SQL query object.</span></li>
<li><a name="a374"></a><span class="src-doc"> */</span></li>
<li><a name="a375"></a><span class="src-key">class </span><a href="../TurboPhpLib/TTpQuery.html">TTpQuery</a> <span class="src-key">extends </span><a href="../TurboPhpLib/TTpDataSource.html">TTpDataSource</a></li>
<li><a name="a376"></a><span class="src-sym">{</span></li>
<li><a name="a377"></a>  <span class="src-doc">/**</span></li>
<li><a name="a378"></a><span class="src-doc">   * SQL to be executed.</span></li>
<li><a name="a379"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a380"></a><span class="src-doc">   */</span></li>
<li><a name="a381"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpQuery.html#var$SQL">$SQL</a><span class="src-sym">;</span></li>
<li><a name="a382"></a>  <span class="src-doc">/**</span></li>
<li><a name="a383"></a><span class="src-doc">   * Name, value pairs of SQL parameters.</span></li>
<li><a name="a384"></a><span class="src-doc">   * The </span><span class="src-doc-inlinetag">{@link $SQL}</span><span class="src-doc"> for this control may contain parameters (macros) of the</span></li>
<li><a name="a385"></a><span class="src-doc">   * form {%&lt;param_name&gt;}. These parameters are replaced by values from the</span></li>
<li><a name="a386"></a><span class="src-doc">   * $Params array.</span></li>
<li><a name="a387"></a><span class="src-doc">   *</span></li>
<li><a name="a388"></a><span class="src-doc">   * Example 1: the SQL contains a line like</span></li>
<li><a name="a389"></a><span class="src-doc">   *  where Cost &gt; {%MinCost}</span></li>
<li><a name="a390"></a><span class="src-doc">   * and the $Params array has</span></li>
<li><a name="a391"></a><span class="src-doc">   *  &quot;MinCost&quot; =&gt; &quot;1000&quot;</span></li>
<li><a name="a392"></a><span class="src-doc">   * the executed SQL will read</span></li>
<li><a name="a393"></a><span class="src-doc">   *  where Cost &gt; 1000</span></li>
<li><a name="a394"></a><span class="src-doc">   *</span></li>
<li><a name="a395"></a><span class="src-doc">   * Example 2: the SQL contains a line like</span></li>
<li><a name="a396"></a><span class="src-doc">   *  order by '{%SortField}'</span></li>
<li><a name="a397"></a><span class="src-doc">   * and the $Params array has</span></li>
<li><a name="a398"></a><span class="src-doc">   *  &quot;SortField&quot; =&gt; &quot;Name&quot;</span></li>
<li><a name="a399"></a><span class="src-doc">   * the executed SQL will read</span></li>
<li><a name="a400"></a><span class="src-doc">   *  order by 'Name'</span></li>
<li><a name="a401"></a><span class="src-doc">   *</span></li>
<li><a name="a402"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">array </span></li>
<li><a name="a403"></a><span class="src-doc">   */</span></li>
<li><a name="a404"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpQuery.html#var$Params">$Params</a><span class="src-sym">;</span></li>
<li><a name="a405"></a>  <span class="src-doc">/**</span></li>
<li><a name="a406"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a407"></a><span class="src-doc">   */</span></li>
<li><a name="a408"></a>  <span class="src-key">function </span><span class="src-id">Init</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a409"></a>  <span class="src-sym">{</span></li>
<li><a name="a410"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">Init</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a411"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$Params">Params</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a412"></a>  <span class="src-sym">}</span></li>
<li><a name="a413"></a>  <span class="src-doc">/**</span></li>
<li><a name="a414"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a415"></a><span class="src-doc">   */</span></li>
<li><a name="a416"></a>  <span class="src-key">function </span><span class="src-id">AfterParse</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a417"></a>  <span class="src-sym">{</span></li>
<li><a name="a418"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">AfterParse</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a419"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$SQL">SQL</a> = <a href="http://www.php.net/base64_decode">base64_decode</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$SQL">SQL</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a420"></a>  <span class="src-sym">}</span></li>
<li><a name="a421"></a>  <span class="src-doc">/**</span></li>
<li><a name="a422"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a423"></a><span class="src-doc">   */</span></li>
<li><a name="a424"></a>  <span class="src-key">function </span><span class="src-id">InterpolateParam</span><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$matches</span><span class="src-sym">)</span></li>
<li><a name="a425"></a>  <span class="src-sym">{</span></li>
<li><a name="a426"></a>    <span class="src-var">$obj </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$App">App</a><span class="src-sym">-&gt;</span><span class="src-id">GetObject</span><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a427"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$obj</span><span class="src-sym">)</span></li>
<li><a name="a428"></a>      <span class="src-var">$p </span>= <span class="src-var">$obj</span><span class="src-sym">-&gt;</span><span class="src-id">GetDefaultValue</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a429"></a>    <span class="src-key">else</span></li>
<li><a name="a430"></a>      <span class="src-var">$p </span>= <a href="../TurboPhpLib/_TpLib_php.html#functionTpSafeArrayGet">TpSafeArrayGet</a><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$Params">Params</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a431"></a>    <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">Interpolate</span><span class="src-sym">(</span><span class="src-var">$p</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a432"></a>  <span class="src-sym">}</span></li>
<li><a name="a433"></a>  <span class="src-doc">/**</span></li>
<li><a name="a434"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a435"></a><span class="src-doc">   */</span></li>
<li><a name="a436"></a>  <span class="src-key">function </span><span class="src-id">Interpolate</span><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$inText</span><span class="src-sym">)</span></li>
<li><a name="a437"></a>  <span class="src-sym">{</span></li>
<li><a name="a438"></a>    <span class="src-key">return </span><a href="http://www.php.net/preg_replace_callback">preg_replace_callback</a><span class="src-sym">(</span></li>
<li><a name="a439"></a>      <span class="src-id">P_QUERY_PARAM</span><span class="src-sym">,</span></li>
<li><a name="a440"></a>      <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-str">'InterpolateParam'</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a441"></a>      <span class="src-var">$inText</span></li>
<li><a name="a442"></a>    <span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a443"></a>  <span class="src-sym">}</span></li>
<li><a name="a444"></a>  <span class="src-doc">/**</span></li>
<li><a name="a445"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a446"></a><span class="src-doc">   */</span></li>
<li><a name="a447"></a>  <span class="src-key">function </span><span class="src-id">InterpolatedQuery</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a448"></a>  <span class="src-sym">{</span></li>
<li><a name="a449"></a>    <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">Interpolate</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$SQL">SQL</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a450"></a>  <span class="src-sym">}</span></li>
<li><a name="a451"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpQuery.html#methodDump">Dump</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a452"></a>  <span class="src-sym">{</span></li>
<li><a name="a453"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">Dump</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a454"></a>    echo <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">SQL</span>: <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$SQL">SQL</a><span class="src-sym">]</span>&lt;<span class="src-id">br</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a455"></a>    <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$Params">Params</a><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">)</span></li>
<li><a name="a456"></a>    <span class="src-sym">{</span></li>
<li><a name="a457"></a>      <a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpQuery.html#var$Params">Params</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a458"></a>      echo <span class="src-str">&quot;&lt;br&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a459"></a>    <span class="src-sym">}</span></li>
<li><a name="a460"></a>  <span class="src-sym">}</span></li>
<li><a name="a461"></a><span class="src-sym">}</span></li>
<li><a name="a462"></a>&nbsp;</li>
<li><a name="a463"></a><span class="src-doc">/**</span></li>
<li><a name="a464"></a><span class="src-doc"> * Label whose contents are obtained from a data source.</span></li>
<li><a name="a465"></a><span class="src-doc"> */</span></li>
<li><a name="a466"></a><span class="src-key">class </span><a href="../TurboPhpLib/TTpDbText.html">TTpDbText</a> <span class="src-key">extends </span><a href="../TurboPhpLib/TTpObj.html#methodTTpObj">TTpObj</a></li>
<li><a name="a467"></a><span class="src-sym">{</span></li>
<li><a name="a468"></a>  <span class="src-doc">/**</span></li>
<li><a name="a469"></a><span class="src-doc">   * Reference to an attached </span><span class="src-doc-inlinetag">{@link TTpDataSource}</span><span class="src-doc">.</span></li>
<li><a name="a470"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">object </span></li>
<li><a name="a471"></a><span class="src-doc">   */</span></li>
<li><a name="a472"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">$DataSource</a><span class="src-sym">;</span></li>
<li><a name="a473"></a>  <span class="src-doc">/**</span></li>
<li><a name="a474"></a><span class="src-doc">   * Name of the field to use.</span></li>
<li><a name="a475"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a476"></a><span class="src-doc">   */</span></li>
<li><a name="a477"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbText.html#var$Field">$Field</a><span class="src-sym">;</span></li>
<li><a name="a478"></a>  <span class="src-doc">/**</span></li>
<li><a name="a479"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a480"></a><span class="src-doc">   */</span></li>
<li><a name="a481"></a>  <span class="src-key">function </span><span class="src-id">AfterParse</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a482"></a>  <span class="src-sym">{</span></li>
<li><a name="a483"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$App">App</a><span class="src-sym">-&gt;</span><span class="src-id">Debug</span><span class="src-sym">)</span></li>
<li><a name="a484"></a>    <span class="src-sym">{</span></li>
<li><a name="a485"></a>      <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">DataSource</a><span class="src-sym">)</span></li>
<li><a name="a486"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">parsed</span> <span class="src-id">empty</span> <span class="src-id">DataSource</span> <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">DataSource</a><span class="src-sym">]</span></span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a487"></a>      <span class="src-var">$s </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">DataSource</a><span class="src-sym">;</span></li>
<li><a name="a488"></a>    <span class="src-sym">}</span></li>
<li><a name="a489"></a>    <span class="src-comm">//</span></li>
<li><a name="a490"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">MarshallObject</span><span class="src-sym">(</span><span class="src-str">'DataSource'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a491"></a>    <span class="src-comm">//</span></li>
<li><a name="a492"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">DataSource</a><span class="src-sym">)</span></li>
<li><a name="a493"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">failed</span> <span class="src-id">to</span> <span class="src-id">get</span> <span class="src-id">DataSource</span> <span class="src-id">object</span> <span class="src-sym">[</span><span class="src-var">$s</span><span class="src-sym">]</span></span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a494"></a>  <span class="src-sym">}</span></li>
<li><a name="a495"></a>  <span class="src-doc">/**</span></li>
<li><a name="a496"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a497"></a><span class="src-doc">   */</span></li>
<li><a name="a498"></a>  <span class="src-key">function </span><span class="src-id">BeforeGenerate</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a499"></a>  <span class="src-sym">{</span></li>
<li><a name="a500"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">BeforeGenerate</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a501"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">DataSource</a><span class="src-sym">)</span></li>
<li><a name="a502"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$Content">Content</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">DataSource</a><span class="src-sym">-&gt;</span><span class="src-id">GetField</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$Field">Field</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a503"></a>    <span class="src-key">else</span></li>
<li><a name="a504"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot;Bad DataSource&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a505"></a>  <span class="src-sym">}</span></li>
<li><a name="a506"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbText.html#methodDump">Dump</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a507"></a>  <span class="src-sym">{</span></li>
<li><a name="a508"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><a href="../TurboPhpLib/TTpObj.html#methodDump">Dump</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a509"></a>    echo <span class="src-str">&quot;DataSource: [&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$DataSource">DataSource</a><span class="src-sym">-&gt;</span><span class="src-id">Name</span>.<span class="src-str">&quot;]&lt;br&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a510"></a>    echo <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">Field</span>: <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbText.html#var$Field">Field</a><span class="src-sym">]</span>&lt;<span class="src-id">br</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a511"></a>  <span class="src-sym">}</span></li>
<li><a name="a512"></a><span class="src-sym">}</span></li>
<li><a name="a513"></a>&nbsp;</li>
<li><a name="a514"></a><span class="src-doc">/**</span></li>
<li><a name="a515"></a><span class="src-doc"> * Input object whose contents are obtained from a data source.</span></li>
<li><a name="a516"></a><span class="src-doc"> */</span></li>
<li><a name="a517"></a><span class="src-key">class </span><a href="../TurboPhpLib/TTpDbInput.html">TTpDbInput</a> <span class="src-key">extends </span><a href="../TurboPhpLib/TTpInput.html">TTpInput</a></li>
<li><a name="a518"></a><span class="src-sym">{</span></li>
<li><a name="a519"></a>  <span class="src-doc">/**</span></li>
<li><a name="a520"></a><span class="src-doc">   * Reference to an attached </span><span class="src-doc-inlinetag">{@link TTpDataSource}</span><span class="src-doc">.</span></li>
<li><a name="a521"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">object </span></li>
<li><a name="a522"></a><span class="src-doc">   */</span></li>
<li><a name="a523"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">$DataSource</a><span class="src-sym">;</span></li>
<li><a name="a524"></a>  <span class="src-doc">/**</span></li>
<li><a name="a525"></a><span class="src-doc">   * Name of the field to use.</span></li>
<li><a name="a526"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a527"></a><span class="src-doc">   */</span></li>
<li><a name="a528"></a>  <span class="src-key">var </span><a href="../TurboPhpLib/TTpDbInput.html#var$Field">$Field</a><span class="src-sym">;</span></li>
<li><a name="a529"></a>  <span class="src-doc">/**</span></li>
<li><a name="a530"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a531"></a><span class="src-doc">   */</span></li>
<li><a name="a532"></a>  <span class="src-key">function </span><span class="src-id">AfterParse</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a533"></a>  <span class="src-sym">{</span></li>
<li><a name="a534"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">AfterParse</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a535"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">MarshallObject</span><span class="src-sym">(</span><span class="src-str">'DataSource'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a536"></a>  <span class="src-sym">}</span></li>
<li><a name="a537"></a>  <span class="src-doc">/**</span></li>
<li><a name="a538"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a539"></a><span class="src-doc">   */</span></li>
<li><a name="a540"></a>  <span class="src-key">function </span><span class="src-id">GetData</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a541"></a>  <span class="src-sym">{</span></li>
<li><a name="a542"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">DataSource</a><span class="src-sym">)</span></li>
<li><a name="a543"></a>      <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">DataSource</a><span class="src-sym">-&gt;</span><span class="src-id">GetField</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$Field">Field</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a544"></a>    <span class="src-key">else</span></li>
<li><a name="a545"></a>    <span class="src-sym">{</span></li>
<li><a name="a546"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot;Bad DataSource&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a547"></a>      <span class="src-key">return </span><span class="src-str">''</span><span class="src-sym">;</span></li>
<li><a name="a548"></a>    <span class="src-sym">}</span></li>
<li><a name="a549"></a>  <span class="src-sym">}</span></li>
<li><a name="a550"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpDbInput.html#methodDump">Dump</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a551"></a>  <span class="src-sym">{</span></li>
<li><a name="a552"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><a href="../TurboPhpLib/TTpInput.html#methodDump">Dump</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a553"></a>    echo <span class="src-str">&quot;DataSource: [&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">DataSource</a><span class="src-sym">-&gt;</span><span class="src-id">Name</span>.<span class="src-str">&quot;]&lt;br&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a554"></a>    echo <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">Field</span>: <span class="src-sym">[</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$Field">Field</a><span class="src-sym">]</span>&lt;<span class="src-id">br</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a555"></a>  <span class="src-sym">}</span></li>
<li><a name="a556"></a><span class="src-sym">}</span></li>
<li><a name="a557"></a>&nbsp;</li>
<li><a name="a558"></a><span class="src-doc">/**</span></li>
<li><a name="a559"></a><span class="src-doc"> * Single line edit-box whose contents are obtained from a data source.</span></li>
<li><a name="a560"></a><span class="src-doc"> */</span></li>
<li><a name="a561"></a><span class="src-key">class </span><a href="../TurboPhpLib/TTpDbEdit.html">TTpDbEdit</a> <span class="src-key">extends </span><a href="../TurboPhpLib/TTpDbInput.html">TTpDbInput</a></li>
<li><a name="a562"></a><span class="src-sym">{</span></li>
<li><a name="a563"></a>  <span class="src-doc">/**</span></li>
<li><a name="a564"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a565"></a><span class="src-doc">   */</span></li>
<li><a name="a566"></a>  <span class="src-key">function </span><span class="src-id">BeforeGenerate</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a567"></a>  <span class="src-sym">{</span></li>
<li><a name="a568"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">BeforeGenerate</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a569"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">DataSource</a><span class="src-sym">)</span></li>
<li><a name="a570"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpInput.html#var$Value">Value</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">DataSource</a><span class="src-sym">-&gt;</span><span class="src-id">GetField</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$Field">Field</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a571"></a>    <span class="src-key">else</span></li>
<li><a name="a572"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot;Bad DataSource&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a573"></a>  <span class="src-sym">}</span></li>
<li><a name="a574"></a><span class="src-sym">}</span></li>
<li><a name="a575"></a>&nbsp;</li>
<li><a name="a576"></a><span class="src-doc">/**</span></li>
<li><a name="a577"></a><span class="src-doc"> * Multi-line edit-box whose contents are obtained from a data source.</span></li>
<li><a name="a578"></a><span class="src-doc"> */</span></li>
<li><a name="a579"></a><span class="src-key">class </span><a href="../TurboPhpLib/TTpDbTextArea.html">TTpDbTextArea</a> <span class="src-key">extends </span><a href="../TurboPhpLib/TTpDbInput.html">TTpDbInput</a></li>
<li><a name="a580"></a><span class="src-sym">{</span></li>
<li><a name="a581"></a>  <span class="src-doc">/**</span></li>
<li><a name="a582"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a583"></a><span class="src-doc">   */</span></li>
<li><a name="a584"></a>  <span class="src-key">function </span><span class="src-id">StoreValue</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a585"></a>  <span class="src-sym">{</span></li>
<li><a name="a586"></a>    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$Content">Content</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpInput.html#var$NewValue">NewValue</a><span class="src-sym">;</span></li>
<li><a name="a587"></a>  <span class="src-sym">}</span></li>
<li><a name="a588"></a>  <span class="src-doc">/**</span></li>
<li><a name="a589"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a590"></a><span class="src-doc">   */</span></li>
<li><a name="a591"></a>  <span class="src-key">function </span><a href="../TurboPhpLib/TTpInput.html#methodGetDefaultValue">GetDefaultValue</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a592"></a>  <span class="src-sym">{</span></li>
<li><a name="a593"></a>    <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$Content">Content</a><span class="src-sym">;</span></li>
<li><a name="a594"></a>  <span class="src-sym">}</span></li>
<li><a name="a595"></a>  <span class="src-doc">/**</span></li>
<li><a name="a596"></a><span class="src-doc">   * </span><span class="src-doc-coretag">@access</span><span class="src-doc"> private</span></li>
<li><a name="a597"></a><span class="src-doc">   */</span></li>
<li><a name="a598"></a>  <span class="src-key">function </span><span class="src-id">BeforeGenerate</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a599"></a>  <span class="src-sym">{</span></li>
<li><a name="a600"></a>    <span class="src-id">parent</span><span class="src-sym">::</span><span class="src-id">BeforeGenerate</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a601"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">DataSource</a><span class="src-sym">)</span></li>
<li><a name="a602"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#var$Content">Content</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$DataSource">DataSource</a><span class="src-sym">-&gt;</span><span class="src-id">GetField</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpDbInput.html#var$Field">Field</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a603"></a>    <span class="src-key">else</span></li>
<li><a name="a604"></a>      <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../TurboPhpLib/TTpObj.html#methodDebug">Debug</a><span class="src-sym">(</span><span class="src-str">&quot;Bad DataSource&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a605"></a>  <span class="src-sym">}</span></li>
<li><a name="a606"></a><span class="src-sym">}</span></li>
<li><a name="a607"></a>&nbsp;</li>
<li><a name="a608"></a><span class="src-comm">/*</span></li>
<li><a name="a609"></a><span class="src-comm">class TTpDbListSource extends TTpListSource</span></li>
<li><a name="a610"></a><span class="src-comm">{</span></li>
<li><a name="a611"></a><span class="src-comm">  var $DataSource;</span></li>
<li><a name="a612"></a><span class="src-comm">  var $Field;</span></li>
<li><a name="a613"></a><span class="src-comm">  function AfterParse()</span></li>
<li><a name="a614"></a><span class="src-comm">  {</span></li>
<li><a name="a615"></a><span class="src-comm">    //echo &quot;[$this-&gt;DataSource]&lt;br&gt;&quot;;</span></li>
<li><a name="a616"></a><span class="src-comm">    //echo ($this-&gt;App-&gt;IsObject($this-&gt;DataSource) ? 'Found' : 'Not found').&quot;&lt;br&gt;&quot;;</span></li>
<li><a name="a617"></a><span class="src-comm">    if (is_string($this-&gt;DataSource))</span></li>
<li><a name="a618"></a><span class="src-comm">      $this-&gt;DataSource = &amp;$this-&gt;App-&gt;GetObject($this-&gt;DataSource);</span></li>
<li><a name="a619"></a>&nbsp;</li>
<li><a name="a620"></a><span class="src-comm">// BAD</span></li>
<li><a name="a621"></a><span class="src-comm">//    if (is_string($this-&gt;DataSource))</span></li>
<li><a name="a622"></a><span class="src-comm">//      $this-&gt;DataSource &amp;= $this-&gt;App-&gt;GetObject($this-&gt;DataSource);</span></li>
<li><a name="a623"></a>&nbsp;</li>
<li><a name="a624"></a><span class="src-comm">// Good</span></li>
<li><a name="a625"></a><span class="src-comm">//    if (is_string($this-&gt;DataSource))</span></li>
<li><a name="a626"></a><span class="src-comm">//      if ($this-&gt;App-&gt;IsObject($this-&gt;DataSource))</span></li>
<li><a name="a627"></a><span class="src-comm">//        $this-&gt;DataSource = &amp;$this-&gt;App-&gt;Objects[$this-&gt;DataSource];</span></li>
<li><a name="a628"></a>&nbsp;</li>
<li><a name="a629"></a><span class="src-comm">//    echo &quot;[&quot;.$this-&gt;DataSource-&gt;Name.&quot;]&lt;br&gt;&quot;;</span></li>
<li><a name="a630"></a><span class="src-comm">  }</span></li>
<li><a name="a631"></a><span class="src-comm">  function GetItems(&amp;$outItems)</span></li>
<li><a name="a632"></a><span class="src-comm">  {</span></li>
<li><a name="a633"></a><span class="src-comm">    $outItems = array();</span></li>
<li><a name="a634"></a><span class="src-comm">    if ($this-&gt;DataSource)</span></li>
<li><a name="a635"></a><span class="src-comm">    {</span></li>
<li><a name="a636"></a><span class="src-comm">      $this-&gt;DataSource-&gt;Rewind();</span></li>
<li><a name="a637"></a><span class="src-comm">      while ($this-&gt;DataSource-&gt;Next())</span></li>
<li><a name="a638"></a><span class="src-comm">      {</span></li>
<li><a name="a639"></a><span class="src-comm">        $field = $this-&gt;DataSource-&gt;GetField($this-&gt;Field);</span></li>
<li><a name="a640"></a><span class="src-comm">        //if ($this-&gt;NumericKeys)</span></li>
<li><a name="a641"></a><span class="src-comm">        //$outItems[] = $this-&gt;DataSource-&gt;GetField($this-&gt;Field);</span></li>
<li><a name="a642"></a><span class="src-comm">        $outItems[$field] = $field;</span></li>
<li><a name="a643"></a><span class="src-comm">      }</span></li>
<li><a name="a644"></a><span class="src-comm">    }</span></li>
<li><a name="a645"></a><span class="src-comm">    else</span></li>
<li><a name="a646"></a><span class="src-comm">      $this-&gt;Debug(&quot;Bad DataSource&quot;);</span></li>
<li><a name="a647"></a><span class="src-comm">  }</span></li>
<li><a name="a648"></a><span class="src-comm">  function Dump()</span></li>
<li><a name="a649"></a><span class="src-comm">  {</span></li>
<li><a name="a650"></a><span class="src-comm">    parent::Dump();</span></li>
<li><a name="a651"></a><span class="src-comm">    echo &quot;DataSource: [&quot;.$this-&gt;DataSource-&gt;Name.&quot;]&lt;br&gt;&quot;;</span></li>
<li><a name="a652"></a><span class="src-comm">    echo &quot;Field: [$this-&gt;Field]&lt;br&gt;&quot;;</span></li>
<li><a name="a653"></a><span class="src-comm">  }</span></li>
<li><a name="a654"></a><span class="src-comm">}</span></li>
<li><a name="a655"></a><span class="src-comm">*/</span></li>
<li><a name="a656"></a>&nbsp;</li>
<li><a name="a657"></a><span class="src-php">?&gt;</span></li>
</ol></pre>
</div>
	<p class="notes" id="credit">
		Documentation generated on Fri, 12 Nov 2004 16:33:35 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</body>
</html>